<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/web/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
      layout:decorate="~{admin/layout}">
<body>
<div class="content-wrap" layout:fragment="content">
    <style>
        .jianju{
            margin:10px;
        }
        .buttoon-height{
            height: 60px;
        }
        a {
            color: #f5f5f5;
            text-decoration: none;
        }
    </style>
    <main id="content" class="content" role="main">
        <ol class="breadcrumb">
            <li>我要搜索</li>
            <li class="active"><a th:href="@{/admin/landMass/manage}">地块搜索</a></li>
        </ol>
        <div class="row">
            <div class="col-md-8">
                <div class="form-group">
                    <div style="width: 50%;">
                        <select style="height: 40px;width: 110px;" name="area" id="area">
                            <option th:each="area: ${area}" th:value="${area.areaLocation_id}"
                                    th:text="${area.serialNumber}"></option>
                        </select>
                        <input type="search" style="width: 110px;" class="form-control"   id="search-input" placeholder="请输入地块编号如'1'">
                        <span class="input-group-btn">
                            <button onclick="selectLandMass()" class="btn btn-secondary">搜索</button>
                        </span>
                    </div>
                </div>
            </div>
            <script>
                function selectLandMass() {
                    if($("#area").val()==null){
                        alert("区域不能为空");
                    }
                    if($("#search-input").val()==null){
                        alert("请输入地块编号");
                    }
                    if(($("#area").val()!=null)&&($("#search-input").val()!=null)){
                        self.location.href = "/admin/landMass/landMass?areaid="+$("#area").val() +"&serialNumber=" + $("#search-input").val();
                    }
                }
            </script>
        </div>
        <div th:each="areaLocation:${areaLocation}">
            <button class="jianju btn btn-success width-100 mb-xs buttoon-height"role="button"
                     th:each="landMass:${areaLocation.landMasses}"
                     th:id="${landMass.landMass_id}">
                <a th:href="@{/admin/landMass/treeWell(landMass_id=${landMass.landMass_id})}" >
                    <span th:text="${landMass.areaLocation.serialNumber}"></span>-<span th:text="${landMass.serialNumber}"></span>
                </a>
            </button>
        </div>
    </main>
</div>
</body>
</html>